.PHONY: all debug clean

TARGET=ubuntu.elf

SOURCES = $(wildcard src/*.c)
HEADERS = $(wildcard inc/*.h)
OBJECTS = $(patsubst src/%.c,obj/%.o,$(SOURCES))

CFLAGS= -I./inc
CFLAGS += -Os
LDFLAGS= -pthread -static

all: obj $(TARGET)

debug: CFLAGS += -DDEBUG
debug: $(TARGET)

$(TARGET): $(OBJECTS)
	$(CC) $(LDFLAGS) -o $@ $^
	strip $@

obj/%.o: src/%.c
	$(CC) -c $< -o $@ $(CFLAGS)

obj:
	mkdir obj

clean:
	rm -rf obj
	rm -f $(TARGET)
